package com.algorithm;

/**
 * @author: sun.hongliang
 * @create: 2019/11/19 12:23
 */
public class ReverseListTest {
    public static void main(String[] args) {

    }

    public ListNode reverseList(ListNode head) {
        ListNode p = head;
        ListNode pr = null;
        ListNode pn = null;
        while (p != null) {
            pn = p.next;
            p.next = pr;
            pr = p;
            p = pn;
        }
        return pr;
    }
}
